﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace MIAP.Negocio.Utiles
{
    public class ListenerExecutor : DefaultEvents
    {
        /// <summary>
        /// lista de errores
        /// </summary>
        private readonly StringBuilder _errores;

        /// <summary>
        /// Obtiene lso errores encontrados en el sistema
        /// </summary>
        public String Errores
        {
            get { return this._errores.ToString(); }
        }

        /// <summary>
        /// Constructor principal de la clase
        /// </summary>
        public ListenerExecutor()
        {
            this._errores = new StringBuilder();
        }

        public override bool OnError(DtsObject source, int errorCode, string subComponent,
           string description, string helpFile, int helpContext, string idofInterfaceWithError)
        {
            this._errores.AppendLine(String.Format("Error en {0}/{1} : {2}", source, subComponent, description));
            return false;
        }
    }
}
